import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ChickenVarietiesVO, ChickenVarietiesForm, ChickenVarietiesQuery } from '@/api/farm/chickenVarieties/types';

/**
 * 查询鸡品种列表
 * @param query
 * @returns {*}
 */

export const listChickenVarieties = (query?: ChickenVarietiesQuery): AxiosPromise<ChickenVarietiesVO[]> => {
  return request({
    url: '/farm/chickenVarieties/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询鸡品种详细
 * @param id
 */
export const getChickenVarieties = (id: string | number): AxiosPromise<ChickenVarietiesVO> => {
  return request({
    url: '/farm/chickenVarieties/' + id,
    method: 'get'
  });
};

/**
 * 新增鸡品种
 * @param data
 */
export const addChickenVarieties = (data: ChickenVarietiesForm) => {
  return request({
    url: '/farm/chickenVarieties',
    method: 'post',
    data: data
  });
};

/**
 * 修改鸡品种
 * @param data
 */
export const updateChickenVarieties = (data: ChickenVarietiesForm) => {
  return request({
    url: '/farm/chickenVarieties',
    method: 'put',
    data: data
  });
};

/**
 * 删除鸡品种
 * @param id
 */
export const delChickenVarieties = (id: string | number | Array<string | number>) => {
  return request({
    url: '/farm/chickenVarieties/' + id,
    method: 'delete'
  });
};
